var box = document.createElement("div");
box.style.backgroundColor = "#000000";
box.style.color = "#FFFFFF";
box.style.width = "640px";
box.style.height = "360px";
box.style.position = "absolute";
box.style.top = "0";
box.style.left = "0";
box.style.textAlign = "center";
box.style.fontSize = "12px";
box.style.fontFamily = "'Lucida Grande', Arial, Helvetica, sans-serif";
box.style.zIndex = "100000";
document.body.appendChild(box);
var box2 = document.createElement("div");
box2.id = "box2"
box2.style.paddingTop = "80px";
box.appendChild(box2);

if (document.getElementById('downloadlink') || getElementByClass('down_ad_butt1')) {
	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).replace(/amp;/gi,'');
	var d = document.getElementById('downloadlink');
	var downloadlink;
	if (d) {
		downloadlink = d.firstChild.href;
	} else {
		d = getElementByClass('down_ad_butt1');
		downloadlink = d.href;
		hashes += "&premium=true";
	}
	var count = document.getElementById("countdown") ? document.getElementById("countdown").innerHTML : 45;
	window.location = 'http://www.mijailr.com/clon_cuevana/player.php?mega_link='+downloadlink+'&count='+count+'&'+hashes;
} else {
	var pag = document.body.innerHTML;
	if (pag.match(/Unfortunately, the link you have clicked is not available/i) || pag.match(/El archivo al que está intentando acceder está temporalmente desactivado/i)) {
		box2.innerHTML = "Lamentablemente, el archivo que intentas ver está temporalmente desactivado. Prueba dentro de unos minutos.";
	}
}
function getElementByClass(theClass) {
	var allHTMLTags=document.getElementsByTagName("*");
	for (i=0; i<allHTMLTags.length; i++) {
		if (allHTMLTags[i].className==theClass) {
			return allHTMLTags[i];
		}
	}
	return false;
}
